package com.cube.truthseer.controller;


import com.cube.truthseer.common.entity.vo.ResultMessage;
import com.cube.truthseer.common.utils.StringUtil;
import com.cube.truthseer.service.IPictureService;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.util.List;


@Slf4j
@RequiredArgsConstructor
@RestController
@RequestMapping("/picture")
public class PictureController {
    private final IPictureService pictureService;

    //返回路径，时间，图片id,时间
    @SneakyThrows
    @ApiOperation("上传单张图片")
    @PostMapping("/fileupload")
    public ResultMessage<String> insertPicture(HttpServletRequest request, MultipartFile file) {
        return pictureService.insertPicture(file);
    }


    @SneakyThrows
    @ApiOperation("上传多张图片")
    @PostMapping("/fileuploads")
    public ResultMessage<String>insertPictures(@RequestParam("files") List<MultipartFile> files){
        return pictureService.insertPictures(files);
    }

    @ApiOperation("查看上传过的图片和编辑过的图片")
    @GetMapping("/queryHistoryPicture")
    public ResultMessage<Object>queryHistoryPicture(){
        return pictureService.queryHistoryPicture();
    }

    @ApiOperation("删除图片")
    @PostMapping("/deletePicture/{pictureId}")
    public ResultMessage<Object>deletePicture(@PathVariable("pictureId")String pictreId){
        return pictureService.deletePicture(pictreId);
    }
    @ApiOperation("删除多张图片")
    @PostMapping("/deletePictures")
    public ResultMessage<Object>deletePictures(@RequestBody List<String>pictures){
        return pictureService.deletePictures(pictures);
    }

    @ApiOperation("AI扩图")
    @PostMapping("/putMakePictureAI")
    public ResultMessage<Object>putMakePictureAI(){
        return pictureService.putMakePictureAI();
    }
    @ApiOperation("一键换天")
    @PostMapping("/putMakePictureAir/{typeId}")
    public ResultMessage<Object>putMakePictureAir(@PathVariable("typeId")Integer typeId){
        return pictureService.putMakePictureAir(typeId);
    }

    @ApiOperation("光照处理")
    @PostMapping("/putMakeLightingTreatment/{typeId}")
    public ResultMessage<Object>putMakeControllLight(@PathVariable("typeId")Integer typeId){
        return pictureService.putMakeLightingTreatment(typeId);
    }
    @ApiOperation("画质增强")
    @PostMapping("/putMakeHighDefinition")
    public ResultMessage<Object>putMakeHighDefinition(){
        return pictureService.putMakeHighDefinition();
    }
    @ApiOperation("证件照生成")
    @PostMapping("/getIdCard")
    public ResultMessage<Object>getIdCard(){
        return pictureService.getIdCard();
    }



}
